<?php

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();

?>

		<div id="container">
		
			<?php thematic_abovecontent(); ?>
		
			<div id="content">
	
	        <?php
	        
            // calling the widget area 'page-top'
            //get_sidebar('page-top');           	               
	        ?>
	        
	        <?php
	        	// calling new posts
	        	$blog_cat = get_option(THEME_NAME . '_blog_cat', 1);
	        	$blog_showposts = get_option(THEME_NAME . '_blog_showposts', 5);
				$paged = get_query_var('paged');
				if(!$paged) $paged =  1;	        	
				$temp = $wp_query;	        	 
	        	$wp_query = new WP_Query(array(
	        		'cat'		=>	$blog_cat,
	        		'showposts'	=>	$blog_showposts,
	        		'paged'		=>	$paged));
	        	if(have_posts()){
		        	while(have_posts()) : the_post();
		        	global $authordata;
		        	echo '<div class="blog-post">' ;
		        	echo '<a class="thumbnail left" href="'.get_permalink().'">';
		        	if (has_post_thumbnail()) {
							$thumb = wp_get_attachment_image_src(
									get_post_thumbnail_id(), 'full');
							echo get_timthumb_img_src($thumb[0], 150, 150,
									get_the_title(), 'img-shadow');
						}
					else {
						echo get_img_src('thumbnail-default.png',get_the_title(), 'img-shadow');
					}	
		        	echo '</a>';
		        	echo '<p class="meta-data"><span class="comment-meta-post">By <a href="'.get_author_posts_url( $authordata->ID, $authordata->user_nicename ).'">'.get_the_author().'</a></span>';
		        	echo '<span class=""> On '.get_the_time('F j,Y').'</span>';
		        	// get comments
		        	$num_comments = get_comments_number(); // for some reason get_comments_number only returns a numeric value displaying the number of comments
					if ( comments_open() ){
					 	  if($num_comments == 0){
					 	  	  $comments = __(' Comment');
					 	  }
					 	  elseif($num_comments > 1){
					 	  	  $comments = __(' Comments');
					 	  }
					 	  else{
					 	  	   $comments =" Comment";
					 	  }
					 	$write_comments = '<span class="comment-meta-post right"><a href="'.get_comments_link().'">'.$num_comments.$comments.'</a></span>';
					 }
					else{$write_comments =  __('<span class="comment-meta-post right">Comments are off for this post</span>');}
					echo $write_comments;
		        	//echo '<span class="comment-meta right">'.get_comments_number().' Comments </span>';
		        	echo '</p>';
		        	//echo '<h1>'.get_the_title().'</h1>';
		        	echo '<p class="title"><a href="'.get_permalink().'">'.get_the_title().'</a></p>';
	        		the_excerpt();
		        	if(function_exists('st_makeEntries')){
						echo '<p class="share-this">';
						echo st_makeEntries();
						echo '</p><!--#share-this-->';
					}
		        	echo '<a class="readmore-link" href="'.get_permalink().'">Read more</a>';
		        	echo '</div><!--End .blog-post-->';
		        	endwhile;
		        	thematic_nav_below();
	        	}
  				$wp_query = null; $wp_query = $temp;
	        ?>
			
	        <?php
	        // calling the widget area 'page-bottom'
	        //get_sidebar('page-bottom');
	        ?>
	
			</div><!-- #content -->
			
			<?php //thematic_belowcontent(); ?> 
			
		</div><!-- #container -->

<?php 

    // action hook for placing content below #container
    //thematic_belowcontainer();

    // calling the standard sidebar 
    thematic_sidebar();
    
    // calling footer.php
    get_footer();

?>